import { request } from '@umijs/max';
import { BaseResponse } from '@/golbal';
import { ApplyType } from '@/models/apply';

/***
 * 申请加入队伍
 */
export async function applyJoinTeam(params: ApplyType.ApplyJoinTeamRequest) {
  return request<BaseResponse<number>>('/apply/join/team', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}

/***
 * 删除申请
 */
export async function applyDeleteTeam(
  params: ApplyType.ApplyDeleteTeamRequest,
) {
  return request<BaseResponse<number>>('/apply/delete/Team', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}

/***
 * 查看所有申请列表 - 管理员
 */
export async function listQueryApplyTeam(
  params: ApplyType.ApplyListQueryTeamRequest,
) {
  return request<BaseResponse<ApplyType.TeamApplyVo[]>>('/apply/list/team', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}

/***
 * 个人查看申请列表
 */
export async function getApplyTeam(params: ApplyType.ApplyGetTeamRequest) {
  return request<BaseResponse<ApplyType.TeamApplyVo[]>>('/apply/Get/Team', {
    method: 'GET',
    params: params,
  });
}

/***
 * 队长查看申请列表
 */
export async function captainGetApplyTeam(
  params: ApplyType.ApplyCaptainGetTeamRequest,
) {
  return request<BaseResponse<ApplyType.TeamApplyVo[]>>('/apply/capatin/Team', {
    method: 'GET',
    params: params,
  });
}
/***
 * 审核通过加入队伍申请
 */
export async function checkJoinApplyTeam(
  params: ApplyType.ApplyCheckJoinTeamRequest,
) {
  return request<BaseResponse<number>>('/apply/check/join/team', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}
/***
 * 拒接队伍加入申请 CheckNoJoinApplyTeam
 */
export async function checkNoJoinApplyTeam(
  params: ApplyType.ApplyCheckNoJoinTeamRequest,
) {
  return request<BaseResponse<number>>('/apply/check/nojoin/team', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}
